home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / linux / atari / source / source.lzh / atari-linux-0.01pl3 / net / unix / unix.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-05  |  1.9 KB  |  64 lines

  1. /*
  2.  * UNIX        An implementation of the AF_UNIX network domain for the
  3.  *        LINUX operating system.  UNIX is implemented using the
  4.  *        BSD Socket interface as the means of communication with
  5.  *        the user level.
  6.  *
  7.  *        This file descibes some things of the UNIX protocol family
  8.  *        module.  It is mainly used for the "proc" sub-module now,
  9.  *        but it may be useful for cleaning up the UNIX module as a
  10.  *        whole later.
  11.  *
  12.  * Version:    @(#)unix.h    1.0.3    05/25/93
  13.  *
  14.  * Authors:    Orest Zborowski, <obz@Kodak.COM>
  15.  *        Ross Biro, <bir7@leland.Stanford.Edu>
  16.  *        Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  17.  *
  18.  *        This program is free software; you can redistribute it and/or
  19.  *        modify it under the terms of the GNU General Public License
  20.  *        as published by the Free Software Foundation; either version
  21.  *        2 of the License, or (at your option) any later version.
  22.  */
  23.  
  24.  
  25. #ifdef _LINUX_UN_H
  26.  
  27.  
  28. struct unix_proto_data {
  29.     int        refcnt;        /* cnt of reference 0=free    */
  30.     struct socket    *socket;    /* socket we're bound to    */
  31.     int        protocol;
  32.     struct sockaddr_un    sockaddr_un;
  33.     short        sockaddr_len;    /* >0 if name bound        */
  34.     char        *buf;
  35.     int        bp_head, bp_tail;
  36.     struct inode    *inode;
  37.     struct unix_proto_data    *peerupd;
  38. };
  39.  
  40. extern struct unix_proto_data unix_datas[NSOCKETS];
  41.  
  42.  
  43. #define last_unix_data        (unix_datas + NSOCKETS - 1)
  44.  
  45.  
  46. #define UN_DATA(SOCK)         ((struct unix_proto_data *)(SOCK)->data)
  47. #define UN_PATH_OFFSET        ((unsigned long)((struct sockaddr_un *)0) \
  48.                             ->sun_path)
  49.  
  50. /*
  51.  * Buffer size must be power of 2. buffer mgmt inspired by pipe code.
  52.  * note that buffer contents can wraparound, and we can write one byte less
  53.  * than full size to discern full vs empty.
  54.  */
  55. #define BUF_SIZE        PAGE_SIZE
  56. #define UN_BUF_AVAIL(UPD)    (((UPD)->bp_head - (UPD)->bp_tail) & \
  57.                                 (BUF_SIZE-1))
  58. #define UN_BUF_SPACE(UPD)    ((BUF_SIZE-1) - UN_BUF_AVAIL(UPD))
  59.  
  60. #endif    /* _LINUX_UN_H */
  61.  
  62.  
  63. extern void    unix_proto_init(struct ddi_proto *pro);
  64.